<body>
    <div class="top-fix">
        <div class="header-box overflow">
            <div class="head">
                <div class="head-lf">
                    <img src="/image/index/logo.png" alt="" />
                </div>
                <div class="head-rg">
                    <!--登录-->
                    <!-- <div class="welcome">
                        <h1 id='userName'>未登录</h1>
                        <span id="loginBtn">登录</span>
                        <span id="layout">退出登录</span>
                    </div> -->
                    <!--登录结束-->
                </div>
            </div>
        </div>
    </div>
    <!--banner-->
    <div class="banner-box">
        <img src="/image/index/banner.png" alt="" />
    </div>
    <!--banner 结束-->
    <!--导航-->
    <div class="nav-box">
        <ul class="nav overflow">
            <li class="act" data-href="/index.html"><a href="/index.html">首页</a></li>
            <li class="act" data-href="/news.html"><a href="/news.html">热点透视</a></li>
            <li class="act" data-href="/knowledge.html"><a href="/knowledge.html">知识服务</a></li>
            <!-- <li class="act" data-href="/periodical.html"><a href="/periodical.html">期刊阅览</a></li> -->
            <li class="act" data-href="/researchArchives.html?sysId=352&type=KJQB&classify=no"><a href="/researchArchives.html?sysId=352&type=KJQB&classify=no">科技情报</a></li>
           
            <li class="act" data-href="/personal_center.html"><a href="/personal_center.html">个人中心</a></li>

            <li class="act" data-href="https://11.89.144.158/hyindex/syst/"><a href="https://11.89.144.158/hyindex/syst/">进入旧版</a></li>

        </ul>
    </div>
    <style>

    </style>
    <script>
        $(function () {
            //消息待办
            // 退出登录
            // 判断是否登录
            if (shared.getCookie('token')) {
                $('#userName').html(JSON.parse(shared.getCookie('userinfo')).name)
                $('#loginBtn').remove();
            } else {
                $('#layout').remove();
                $('#userName').html('未登录')
            }
            // 前往后台系统
            $('#userName').click(function(e){
                window.open('/admin')
            })
            // 登录
            $('#loginBtn').click(function(e){
               window.location.href='/login.html' 
            })
            // 退出登录
            $('#layout').click(function (e) {
                e.stopPropagation;
                e.preventDefault;
                layer.open({
                    title: '提示',
                    content: '你确定要退出登录吗？',
                    time: 0,//不自动关闭
                    btn: ['确定', '取消'],
                    yes: function (index) {
                        layer.close(index);
                        shared.setCookie('userinfo', '');
                        // // 返回token
                        shared.setCookie('token', '');
                        $('#userName').html('')
                        alert('退出成功！');
                        // 返回首页
                        window.location.href = "/index.html";
                    }
                })
            })
            $('.nav li').click(function (e) {
                window.location.href = $(e.target).attr('data-href');
            })
            $('#toPerson').click(function (e) {
                window.open('/personal_center.html')
            })
        })
    </script>